home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / devel / tcl / tclx7_31.z / tclx7_31 / tcldev / tclX7.3a-p1 / tests / setfuncs.test < prev    next >
Encoding:
Text File  |  1994-01-23  |  3.4 KB  |  145 lines

  1. #
  2. # setfuncs.test
  3. #
  4. # Tests for tcl.tlib set functions.
  5. #---------------------------------------------------------------------------
  6. # Copyright 1992-1993 Karl Lehenbauer and Mark Diekhans.
  7. #
  8. # Permission to use, copy, modify, and distribute this software and its
  9. # documentation for any purpose and without fee is hereby granted, provided
  10. # that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11. # Mark Diekhans make no representations about the suitability of this
  12. # software for any purpose.  It is provided "as is" without express or
  13. # implied warranty.
  14. #------------------------------------------------------------------------------
  15. # $Id: setfuncs.test,v 3.0 1993/11/19 06:58:07 markd Rel $
  16. #------------------------------------------------------------------------------
  17. #
  18.  
  19. if {[info procs test] == ""} then {source testlib.tcl}
  20. eval $SAVED_UNKNOWN
  21.  
  22. Test setfuncs-1.1 {union command} {
  23.     union "" ""
  24. } 0 ""
  25.  
  26. Test setfuncs-1.2 {union command} {
  27.     union a ""
  28. } 0 "a"
  29.  
  30. Test setfuncs-1.3 {union command} {
  31.     union "a b" "b c"
  32. } 0 "a b c"
  33.  
  34. Test setfuncs-1.4 {union command} {
  35.     union "a b c d" "a b c d"
  36. } 0 "a b c d"
  37.  
  38. Test setfuncs-1.5 {union command} {
  39.     union "a d c d b" "b d c a a b d a b c d"
  40. } 0 "a b c d"
  41.  
  42. Test setfuncs-1.6 {union command} {
  43.     union "d c b a e f" ""
  44. } 0 "a b c d e f"
  45.  
  46. Test setfuncs-1.7 {union command} {
  47.     union "" "f e d c b a"
  48. } 0 "a b c d e f"
  49.  
  50. Test setfuncs-1.8 {union command} {
  51.     union "{n p}" "f e d c b a"
  52. } 0 "a b c d e f {n p}"
  53.  
  54. Test setfuncs-1.9 {union command} {
  55.     union "{n p}" "f e d c {n p} b a"
  56. } 0 "a b c d e f {n p}"
  57.  
  58. Test setfuncs-1.10 {union command} {
  59.     union "{n p} z {n p} z" "f e d c {n p} b a"
  60. } 0 "a b c d e f {n p} z"
  61.  
  62. Test setfuncs-2.1 {intersect command} {
  63.     intersect "" ""
  64. } 0 ""
  65.  
  66. Test setfuncs-2.2 {intersect command} {
  67.     intersect "a b c" ""
  68. } 0 ""
  69.  
  70. Test setfuncs-2.3 {intersect command} {
  71.     intersect "" "a b c"
  72. } 0 ""
  73.  
  74. Test setfuncs-2.4 {intersect command} {
  75.     intersect "d f b" "a b c"
  76. } 0 "b"
  77.  
  78. Test setfuncs-2.5 {intersect command} {
  79.     intersect "a p q d v m b n o z t d f b" "a b c"
  80. } 0 "a b"
  81.  
  82. Test setfuncs-2.6 {intersect command} {
  83.     intersect "d c b a e f" "{n p}"
  84. } 0 ""
  85.  
  86. Test setfuncs-2.7 {intersect command} {
  87.     intersect "d c" "f e d c b a"
  88. } 0 "c d"
  89.  
  90. Test setfuncs-2.8 {intersect command} {
  91.     intersect "a f {n p} e" "f e d c b a"
  92. } 0 "a e f"
  93.  
  94. Test setfuncs-2.9 {intersect command} {
  95.     intersect "{n p} f d" "f e d c {n p} b a"
  96. } 0 "d f {n p}"
  97.  
  98. Test setfuncs-2.10 {intersect command} {
  99.     intersect "{n p} z {n p} z" "f e d c {n p} b a"
  100. } 0 "{n p}"
  101.  
  102. Test setfuncs-3.1 {intersect3 command} {
  103.     intersect3 "" ""
  104. } 0 "{} {} {}"
  105.  
  106. Test setfuncs-3.2 {intersect3 command} {
  107.     intersect3 "a b c" ""
  108. } 0 "{a b c} {} {}"
  109.  
  110. Test setfuncs-3.3 {intersect3 command} {
  111.     intersect3 "" "a b c"
  112. } 0 "{} {} {a b c}"
  113.  
  114. Test setfuncs-3.4 {intersect3 command} {
  115.     intersect3 "d f b" "a b c"
  116. } 0 "{d f} b {a c}"
  117.  
  118. Test setfuncs-3.5 {intersect3 command} {
  119.     intersect3 "a p q d v m b n o z t d f b" "a b c"
  120. } 0 "{d f m n o p q t v z} {a b} c"
  121.  
  122. Test setfuncs-4.1 {lrmdups command} {
  123.     lrmdups {a d b c eee b d 1}
  124. } 0 {1 a b c d eee}
  125.  
  126. Test setfuncs-4.2 {lrmdups command} {
  127.     lrmdups {aaa aaa aaaa aaa aaa }
  128. } 0 {aaa aaaa}
  129.  
  130. Test setfuncs-4.3 {lrmdups command} {
  131.     lrmdups {{} aaa {} aaa aaa }
  132. } 0 {{} aaa}
  133.  
  134. Test setfuncs-4.4 {lrmdups command} {
  135.     lrmdups {aaa}
  136. } 0 {aaa}
  137.  
  138. Test setfuncs-4.5 {lrmdups command} {
  139.     lrmdups [list {ma mb} {mc md} {ma mb}]
  140. } 0 {{ma mb} {mc md}}
  141.  
  142. rename unknown {}
  143.  
  144.  
  145.